package cn.golxen.rsms.exception;


import cn.golxen.rsms.commons.Result;
import cn.golxen.rsms.exception.exceptionClass.*;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionController {

    @ExceptionHandler(value = {GetBarcodeInfoException.class})
    public Result barcodeInfoException(GetBarcodeInfoException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = {AddGoodsStoreException.class})
    public Result addGoodsStoreException(AddGoodsStoreException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = {RuntimeException.class})
    public Result unknownException(UnknownException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = {GetGoodsInfoException.class})
    public Result getGoodsInfoException(GetGoodsInfoException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = {ImportExcelException.class})
    public Result importExcelException(ImportExcelException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = {PayException.class})
    public Result payException(PayException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { RegisterUserException.class})
    public Result registerUserException( RegisterUserException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { RegisterMailException.class})
    public Result registerMailException( RegisterMailException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { MailCodeErrorException.class})
    public Result mailCodeErrorException( MailCodeErrorException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { LoginUserException.class})
    public Result loginException( LoginUserException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { AddStoreException.class})
    public Result addStoreException( AddStoreException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { AddStoreOffersException.class})
    public Result addStoreOffersException( AddStoreOffersException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { GetUserMainNullException.class})
    public Result getUserMainNullException( GetUserMainNullException e){
        return new Result(e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = { AuthorityException.class})
    public Result authorityException( AuthorityException e){
        return new Result(e.getCode(),e.getMessage());
    }


}
